package com.zxsj.fdk.study.common.error;

/**
 * @Description: BaseErrorMessage
 * @Author lishuaishuai
 * @Date 2020/11/2 上午10:54
 **/
public enum BaseErrorMessage implements ErrorMsg {
    BAD_REQUEST(400, "Bad Request"),
    UNAUTHORIZED(401, "Unauthorized"),
    FORBIDDEN(403, "Forbidden"),
    NOT_FOUND(404, "Not Found"),
    REQUEST_TIMEOUT(408, "Request Timeout"),
    REPEATED_SUBMISSION(499, "Repeated Submission"),
    INTERNAL_SERVER_ERROR(500, "服务开小差了"),
    BAD_GATEWAY(502, "Bad Gateway"),
    GATEWAY_TIMEOUT(504, "Gateway Timeout"),
    ONCE_SECURE_ERROR(4001, "Once Secure Error"),
    SIGNATRUE_ERROR(4002, "Signature Error"),
    GLOBAL_ERROR(1000, "服务开小差了"),
    GLOBAL_HALFSUCCESS(2000, "global half success"),

    // 用户操作
    USER_PHONE_ALREADY_EXIST(1001, "手机号已经存在"),
    USER_LOGIN_ACCOUNT_ALREADY_EXIST(1002, "登录账号已经存在"),
    USER_NOT_EXIST(1003, "用户不存在"),
    CANNOT_UPDATE_CUR_USER(1004, "该用户不能被修改，或无操作权限"),
    CODE_ERROR(1005, "验证码错误"),

    //用户登录
    USER_LOGIN_ACCOUNT_NOT_EXIST(1005, "登录账号不存在"),
    USER_LOGIN_PASSWORD_ERROR(1006, "密码错误"),
    USER_PASSWORD_NEW_EQUAL_OLD(1007, "新旧密码相等"),
    USER_ROLE_NOT_EXIST(1008, "用户角色缺失"),
    USER_PHONE_NOT_EXIST(1009, "请先申请账号"),
    USER_ACCOUNT_WAITING_AUDIT(1210, "您的账号正在审批，请收到通过短信后再登录"),


    // 邀请注册
    USER_INVITER_NOT_EXIST(1003, "邀请用户不存在"),
    MERCHANT_ALREATED_INVITED(1004, "商户已经被邀请注册了"),
    MERCHANT_NOT_EXIST(1005, "商户不存在"),

    //
    INVALID_USERID(1011, "userId is null"),
    ILLEGAL_PARAM(1012, "参数不合规 "),
    CALL_USER_API_FAILED(1013, "调用用户服务失败"),
    HTTP_METHOD_ERROR(1014, "请求方式错误"),


    REDISSON_LOCK_EXCEPTION(2000, "LockError"),


    RECHARGE_PACKAGE_TYPE_ERROR(3001, "充值包类型错误"),
    INVALID_ENUM_TYPE(3002, "枚举类型错误"),

    // 商户迁移
    MERCHANT_TRANSFER_TARGET_MOBILE_IS_EMPTY(3501, "迁移目标手机号为空"),
    MERCHANT_TRANSFER_TARGET_USER_NOT_EXIST(3502, "迁移目标对象不存在"),
    MERCHANT_CANNOT_TRANSFER_TO_OWN(3503, "迁移目标对象不能是自己"),
    MERCHANT_TRANSFER_USER_FAILED(3504, "用户中商户迁移失败"),

    ;

    private int code;
    private String message;

    private BaseErrorMessage(int code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public int getCode() {
        return this.code;
    }

    @Override
    public String getMsg() {
        return this.message;
    }
}
